home *** CD-ROM | disk | FTP | other *** search
- ;**************************************************************
- ;
- ; biquad.asm
- ;
- ; staff
- ;
- ; 06-04-91
- ;
- ; (C) Texas Instruments Inc., 1992
- ;
- ; Refer to the file 'license.txt' included with this
- ; this package for usage and license information.
- ;
- ;**************************************************************
- .title "N Cascaded BiQuad IIR Filters"
- .mmregs
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; This routine implements N cascaded blocks of biquad IIR
- ; canonic type II filters. Each biquad requires 3 data
- ; memory locations d(n),d(n-1),d(n-2), and 5 coefficients
- ; a1,a2,b0,b1,b2.
- ; For each block: d(n) = x(n)+d(n-1)a1+d(n-2)a2
- ; y(n) = d(n)b0+d(n-1)b1+d(n-2)b2
- ;
- ; Coefficients Storage: (low to high data memory)
- ; a2,a1,b2,b1,b0, ... ,a2,a1,b2,b1,b0
- ; 1st biquad Nth biquad
- ;
- ; State Variables: (low to high data memory)
- ; d(n),d(n-1),d(n-2), ... ,d(n),d(n-1),d(n-2)
- ; Nth biquad 1st biquad
- ;
- ; Entry Conditions:
- ; AR1 -> d(n-2) of 1st biquad
- ; AR2 -> a2 of 1st biquad
- ; AR3 -> input Q15 number
- ; AR4 -> output Q15 number
- ; DP = 0, PM = 0, ARP = 3
- ;
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
- BIQUAD: ;Setup variables;
- ZPR ;Clear P register
- LACC *,15,AR1 ;Get Q15 input
- SPLK #2,INDX ;Setup index register
- SPLK #N-1,BRCR ;Setup count
-
- ;Begin computation
- RPTB ELOOP-1 ;repeat for N biquads
- LOOP: LT *-,AR2 ;T = d(n-2)
- MPYA *+,AR1 ;Acc = x(n), P = d(n-2)a2
- LTA *-,AR2 ;Acc += d(n-2)a2, T = d(n-1)
- MPY *+ ;P = d(n-1)a1
- LTA *+,AR1 ;Acc += d(n-1)a1, T = b2
- SACH *0+,1 ;Save d(n)
- MPY *- ;P = d(n-2)b2
- LACL #0 ;Acc = 0
- LTD *-,AR2 ;T = d(n-1), d(n-2) = d(n-1)
- MPY *+,AR1 ;Acc += d(n-2)b2, P = d(n-1)b1
- LTD *-,AR2 ;T = d(n), d(n-1) = d(n)
- MPY *+,AR1 ;Acc += d(n-1)b1, P = d(n)b0
- ELOOP:
- LTA *,AR4 ;Final accumulation
- SACH *,1 ;Save output in Q15 format